import request from '@/utils/request';
import moment from 'moment'

// 获取箱包管理列表
export function list(params) {

  if (params.startTime) params.startTime = moment(params.startTime).format('YYYY-MM-DD')
  if (params.endTime) params.endTime = moment(params.endTime).format('YYYY-MM-DD')

  return request('/luggage/pkgManage/list', {
    method: 'get',
    params
  });
}

// 新增箱包
export function save(data) {
  return request('/luggage/pkgManage/save', {
    method: 'post',
    data
  });
}

// 修改/删除箱包
export function update(data) {
  return request('/luggage/pkgManage/update', {
    method: 'post',
    data
  });
}

// 新增箱包数量
export function updateCount(data) {
  return request('/luggage/pkgManage/updateCount', {
    method: 'post',
    data
  });
}

// 获取登录用户所属航站
export function getUserServiceCity() {
  return request('/luggage/pkgManage/getUserServiceCity', {
    method: 'get'
  });
}

// 批量删除
export function batchDelete(data) {
  return request('/luggage/pkgManage/batchDelete', {
    method: 'post',
    data
  });
}

// 获取箱包详细信息
export function getDetail(data) {

  if (data.startTime) data.startTime = moment(data.startTime).format('YYYY-MM-DD')
  if (data.endTime) data.endTime = moment(data.endTime).format('YYYY-MM-DD')

  return request('/luggage/pkgManage/getDetail', {
    method: 'get',
    params: data
  });
}